<?php

require_once 'Zend/Controller/Action.php';
require_once 'Zend/Auth.php';

class Safe_AccountController extends Zend_Controller_Action
{
	protected $uid = NULL;
	protected $root;
	
    public function init()
    {
        parent::init();
		$this->root = dirname(dirname(__FILE__));
	
		$auth = Zend_Auth::getInstance();
		if ($auth->hasIdentity()) {
			$this->uid = $auth->getIdentity();
		}
	}
	public function indexAction()
	{
		$this->view->title = 'User Control Panel';
		$this->view->message = 'Checking';
		$this->view->debug = $this->uid;
	}

	public function passwordAction()
	{
		$this->view->title = 'Password Change Form';
		$this->view->message = '';
		$this->view->form = $this->getPasswordForm();
	}
	
	private function getPasswordForm()
	{
		require_once $this->root.'/forms/PasswordForm.php';
		return new PasswordForm(array(
			'action' => '/safe/account/password/edit',
			'method' => 'post',
		));
	}
}
?>